<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户信息</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/index_work.css">
</head>
<body>

    <table>
        <tr>
            <th colspan="6">用户信息</th>
        </tr>
        <tr>
            <th>用户编号</th>
            <th>用户名</th>
            <th>密码</th>
            <th>年龄</th>
            <th>性别</th>
            <th>邮箱</th>
        </tr>
        <c:forEach items="${page.list}" var="user">
            <tr>
                <td>${user.id}</td>
                <td>${user.username}</td>
                <td>${user.password}</td>
                <td>${user.age}</td>
                <td>${user.sex}</td>
                <td>${user.email}</td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="6">
                <c:if test="${not page.isFirstPage}">
                    <a href="${pageContext.request.contextPath}/users/1">首页</a>
                    <a href="${pageContext.request.contextPath}/users/${page.prePage}">上一页</a>
                </c:if>

                <c:forEach items="${page.navigatepageNums}" var="i">
                    <c:if test="${i == page.pageNum}">
                        <a href="${pageContext.request.contextPath}/users/${i}" style="color: red;">[${i}]</a>
                    </c:if>
                    <c:if test="${i != page.pageNum}">
                        <a href="${pageContext.request.contextPath}/users/${i}">${i}</a>
                    </c:if>
                </c:forEach>

                <c:if test="${not page.isLastPage}">
                    <a href="${pageContext.request.contextPath}/users/${page.nextPage}">下一页</a>
                    <a href="${pageContext.request.contextPath}/users/${page.pages}">末页</a>
                </c:if>
            </td>
        </tr>
    </table>

</body>
</html>
